import sys

print("{:=^60}".format("电子计算机"))

print("请选择运行方式:")
print("1.以分步输入方式进行计算")
print("2.以表达式形式进行计算")
print("请输入选择:'1'或'2")

choice = input()

if choice == "1":
    data = 0
    for i in range(100):
        if i == 0:
            print("请输入第一个数据:")
            data = float(input())
        else:
            print("上次的运行结果将作为这次运算的基础数据")
        print("请输入要进行的运算:\n支持以下运算:'+','-','*','/'")
        symbol = input()
        print("请输入进行运算的数据:")
        data_in = float(input())

        if symbol == "+":
            data = data + data_in
        elif symbol == "-":
            data = data - data_in
        elif symbol == "*":
            data = data * data_in
        elif symbol == "/":
            data = data / data_in
        else:
            print("错误选择,程序结束!")
            sys.exit()

        print("运行如下:")
        print("{:.2f}".format(data))

        print("继续运行请输入'1'\n结束运行请输入'2'")
        ch = input()
        if ch == "2":
            break

elif choice == "2":
    print("请严格按照以下格式输入:")
    print("(10+20)*10.0/10")

    expression = input("请输入:\n")
    result = eval(expression)
    formatted_result = "{:.2f}".format(result)
    print("结果如下:")
    print(formatted_result)
else:
    print("错误选择,程序结束!")
